﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Input;

namespace _MetalSlug.Form.OptionScreen
{
    public class AudioSettingDisplayer : SettingDisplayer
    {
        public AudioSettingDisplayer()
        {
            InitialAttribute("Music:",new Vector2(90,200),50);
        }

        public override void Draw(SpriteBatch spriteBatch, SpriteFont currentFont, Color defaultColor, Color chosenColor)
        {
            base.Draw(spriteBatch, currentFont, defaultColor, chosenColor);
            Color currentColor = defaultColor;
            if (IsSetting)
            {
                currentColor = chosenColor;
            }

            Vector2 newPosition = new Vector2(StartPoint.X + currentFont.MeasureString(Title).X + Spacing, StartPoint.Y);
            spriteBatch.DrawString(currentFont, !GameUtil.Audio.IsMuting ? "<On>" : "<Off>", newPosition, currentColor);
        }

        public override void ChangeOption()
        {
            if (UserInput.isKeyClicked(Keys.Right) || UserInput.isKeyClicked(Keys.Left))
            {
                GameUtil.Audio.IsMuting = !GameUtil.Audio.IsMuting;
            }
        }
    }
}
